#pragma once
#include "PointLabCore/IPointCloud.h"
#include <osg/Geometry>

class PointCloud :public PointLabCore::IPointCloud, public osg::Geometry
{
public:
	PointCloud();
	virtual ~PointCloud();

	virtual PointLabCore::CLASS_TYPE classID() const override;

	virtual PointLabCore::Entity* createInstance() override;

	virtual bool hasPoint() const override;
	virtual PointLabCore::Uint getPointNum() const override;
	virtual void resizePointNum(PointLabCore::Uint num) override;
	virtual void setPointCoord(PointLabCore::Uint pid, const PointLabCore::Vector3& coord) override;
	virtual PointLabCore::Vector3 getPointCoord(PointLabCore::Uint pid) const override;
	virtual void appendPointCoord(const PointLabCore::Vector3& coord) override;

	virtual bool hasNormal() const override;
	virtual PointLabCore::Uint getNormalNum() const override;
	virtual void resizeNormalNum(PointLabCore::Uint num) override;
	virtual void setPointNormal(PointLabCore::Uint pid, const PointLabCore::Vector3& normal) override;
	virtual PointLabCore::Vector3 getPointNormal(PointLabCore::Uint pid) const override;
	virtual void appendPointNormal(const PointLabCore::Vector3& normal) override;

	virtual bool hasColor() const override;
	virtual PointLabCore::Uint getColorNum() const override;
	virtual void resizeColorNum(PointLabCore::Uint num) override;
	virtual void setPointColor(PointLabCore::Uint pid, const PointLabCore::Color4& color) override;
	virtual PointLabCore::Color4 getPointColor(PointLabCore::Uint pid) override;
	virtual void appendPointColor(const PointLabCore::Color4& color) override;

	virtual void clearAll() override;

	virtual void prepareDisplayForRefresh();

private:
	osg::ref_ptr<osg::Vec3Array>  mPointList;
	osg::ref_ptr<osg::Vec3Array>  mNormalList;
	osg::ref_ptr<osg::Vec4Array>  mColorList;
};
